Xbasic

fedex_delivery_status Function

Syntax

dim Status as C = fedex_delivery_status(C tracking_num, C apiKey, C secretKey)

Arguments

tracking_numCharacter

The tracking number of a shipment sent using FedEx.

apiKeyCharacter

Your FedEx API key.

secretKeyCharacter

Your FedEx secret key.

Returns

StatusCharacter

Returns the status of the the tracking number. If API credentials are not supplied or are incorrect, returns an error message.

Description

Contacts the FedEx web site and looks up the status of the specified tracking number

Discussion

The fedex_delivery_status() function contacts the FedEx web site and looks up the status of a shipment sent through FedEx.

For example:

dim trackNum as c = "YOUR_TRACKING_NUMBER"
dim apiKey as c = "YOUR_API_KEY"
dim secretKey as c = "YOUR_API_SECRET"

?fedex_delivery_status(trackNum)
= "Deprecated: Use of this function without a FedEx API Key and corresponding Secret Key is deprecated. Please specify the required API Key and Secret Key."

?fedex_delivery_status(trackNum, apiKey, secretKey)
= "Delivered"

Obtaining a FedEx API Key

An API key can be obtained from the FedEx developer portal. You will need to create a developer account with FedEx.

  1. Go to https://developer.fedex.com/api/en-us/home.html and sign up for an account.

  2. If prompted to create an organization, select "I work for a company that ships with FedEx and needs to integrate FedEx technology into their system."

  3. Next, navigate to My Projects using the left side menu.

  4. Create a new project.

  5. At the prompt asking why you need API access, select "I work for a company that ships with FedEx and needs to integrate FedEx technology into their system." Specify an name you'd like for the project. Check "Track API" under Select APIs, then click Next.

  6. Accept the terms presented.

  7. Configure project as desired on the Step 3 page and then click to Create your project.

  8. You will now be presented with the Project Overview page for your newly created project. Be sure to select Production Key at the top of the page. The default is to present a Test Key, which will not work.

  9. Configure the Production Key by specifying a key name and linking a Fedex shipping account, then click Next. If you do not have a shipping account, you will need to create one.

  10. Your newly generated production keys will then be presented. You will provide these keys to the fedex_delivery_status() function.

See Also